package com.weetop.akly.apiUtils;


import com.weetop.akly.base.mvp.BaseModel;
import com.weetop.akly.bean.AccountInfoBean;
import com.weetop.akly.bean.ApproveFromKeyBean;
import com.weetop.akly.bean.ApproveInfoBean;
import com.weetop.akly.bean.ApproveItem;
import com.weetop.akly.bean.BaseCountBean;
import com.weetop.akly.bean.DaySignBean;
import com.weetop.akly.bean.DepartmentBean;
import com.weetop.akly.bean.LoginBean;
import com.weetop.akly.bean.MemberBean;
import com.weetop.akly.bean.MsgListBean;
import com.weetop.akly.bean.RongImUserInfoBean;
import com.weetop.akly.bean.SalaryBean;
import com.weetop.akly.bean.SignDayBean;
import com.weetop.akly.bean.SignInLogBean;
import com.weetop.akly.bean.SignRecordBean;
import com.weetop.akly.bean.TrainBean;
import com.weetop.akly.bean.TrainItem;
import com.weetop.akly.bean.TrainResult;
import com.weetop.akly.bean.UploadFileBean;
import com.weetop.akly.bean.VacationLogBean;
import com.weetop.akly.bean.VoteBean;
import com.weetop.akly.bean.VoteItem;
import com.weetop.akly.bean.WorkGroupBean;
import com.weetop.akly.bean.WorkLogResultBean;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Url;

/**
 * File descripition:
 * <p>
 * \@GET  Observable    @Query
 * \@FormUrlEncoded     @POST   Observable  @FieldMap   @FieldMap HashMap<String, String> params
 * \@Multipart  @POST   Observable  @PartMap    @PartMap Map<String, RequestBody> map
 *
 * @author lp
 * @date 2018/6/19
 */

public interface ApiServer {


    /**
     * 登录
     */
    @FormUrlEncoded
    @POST("login")
    Observable<BaseModel<LoginBean>> toLogin(@FieldMap() Map<String, String> data);


    /**
     * 部门列表
     */
    @FormUrlEncoded
    @POST("book/show")
    Observable<BaseModel<ArrayList<DepartmentBean>>> getDepartmentList(@FieldMap() Map<String, String> data);

    /**
     * 部门成员
     */
    @FormUrlEncoded
    @POST("book/department")
    Observable<BaseModel<ArrayList<MemberBean>>> getMemberList(@Field("department_id") String department_id);

    /**
     * 部门成员
     */
    @FormUrlEncoded
    @POST("book/search")
    Observable<BaseModel<ArrayList<MemberBean>>> searchMembers(@Field("keywords") String keywords);


    /**
     * 获取用户所在考勤组列表
     */
    @POST("work/checkin01")
    Observable<BaseModel<ArrayList<WorkGroupBean>>> getWrokGroupList();


    @FormUrlEncoded
    @POST("work/overtime/list")
    Observable<BaseModel<BaseCountBean<ApproveItem>>> overTimeList(@FieldMap() HashMap<String, String> map);

    /**
     * 获取当前打卡班次
     */
    @FormUrlEncoded
    @POST("work/checkin02")
    Observable<BaseModel<WorkLogResultBean>> getWorkLogList(@Field("group_id") String group_id);


    /**
     * 签到打卡
     */
    @FormUrlEncoded
    @POST("work/checkin03")
    Observable<BaseModel<String>> toWorkSign(@FieldMap() Map<String, String> data);


    /**
     * 个人信息接口
     */
    @POST("user/getUserInfo")
    Observable<BaseModel<AccountInfoBean>> getAccountInfo();


    /**
     * 聊天用户信息接口
     */
    @FormUrlEncoded
    @POST("chat/getUserInfo")
    Observable<BaseModel<RongImUserInfoBean>> getRongImUserInfo(@Field("user_id") String user_id);

    /**
     * 消息主页接口
     */
    @POST("message/getMessageIndex")
    Observable<BaseModel<ArrayList<MsgListBean>>> getHomeMsgList();

    /**
     * 消息列表接口
     */
    @FormUrlEncoded
    @POST("message/getMessageList")
    Observable<BaseModel<SignRecordBean>> getSignRecoed(@FieldMap() Map<String, String> data);

//    /**
//     * 消息列表接口
//     */
//    @FormUrlEncoded
//    @POST("work/getCheckinWatch02")
//    Observable<BaseModel<ArrayList<MsgBean>>> getSignRecoed(@FieldMap() Map<String, String> data);

    /**
     * 获取审批单表单选项
     *
     * @param model_id 1:补卡申请	2:请假申请	3:外出申请	4:外勤申请
     */
    @FormUrlEncoded
    @POST("plugin/getApproveFormKey")
    Observable<BaseModel<ArrayList<ApproveFromKeyBean>>> getApproveFormKeyList(@Field("model_id") String model_id);

    /**
     * 获取审批列表
     *
     * @param // model_id  1:补卡申请	2:请假申请	3:外出申请	4:外勤申请
     */
    @FormUrlEncoded
    @POST("user/getApproveList")
    Observable<BaseModel<BaseCountBean<ApproveItem>>> getApproveList(@FieldMap() Map<String, String> data);

    /**
     * 获取审批列表
     *
     * @param // model_id  1:补卡申请	2:请假申请	3:外出申请	4:外勤申请
     */
    @FormUrlEncoded
    @POST("work/goOut/list")
    Observable<BaseModel<BaseCountBean<ApproveItem>>> getGoOutList(@FieldMap() Map<String, String> data);

    /**
     * 获取审批列表
     *
     * @param // model_id  1:补卡申请	2:请假申请	3:外出申请	4:外勤申请
     */
    @FormUrlEncoded
    @POST("work/wq/list")
    Observable<BaseModel<BaseCountBean<ApproveItem>>> getWQList(@FieldMap() Map<String, String> data);
    /**
     * 获取审批列表
     *
     * @param // model_id  1:补卡申请	2:请假申请	3:外出申请	4:外勤申请 5,加班申请
     */
    @FormUrlEncoded
    @POST("work/overtime/list")
    Observable<BaseModel<BaseCountBean<ApproveItem>>> getOverTimeList(@FieldMap() Map<String, String> data);
    /**
     * 考勤打卡日志
     *
     * @param page 第x页，默认1
     */
    @FormUrlEncoded
    @POST("work/getCheckinLog")
    Observable<BaseModel<ArrayList<SignInLogBean>>> getCheckinLog(@Field("page") String page);

    /**
     * 日历图
     */
    @FormUrlEncoded
    @POST("work/getCheckinWatch01")
    Observable<BaseModel<List<SignDayBean>>> getCheckinWatch(@Field("month") String month);

    /**
     * 日打卡情况
     */
    @FormUrlEncoded
    @POST("work/getCheckinWatch02")
    Observable<BaseModel<ArrayList<DaySignBean>>> getDateCheckinWatch(@Field("day") String day);

    /**
     * 获取审批详情
     */
    @FormUrlEncoded
    @POST("work/getApproveInfo")
    Observable<BaseModel<ApproveInfoBean>> getApproveInfo(@Field("approve_id") String approve_id);


    /**
     * 获取审批详情
     */
    @FormUrlEncoded
    @POST("work/vacation/log/list")
    Observable<BaseModel<BaseCountBean<ApproveItem>>> vacationLogList(@FieldMap() Map<String, Object> params);


    /**
     * 获取审批详情
     */
    @FormUrlEncoded
    @POST("work/cancelApprove")
    Observable<BaseModel<Object>> cancelApprove(@Field("approve_id") String approve_id);

    /**
     * 审批请假接口
     */
    @FormUrlEncoded
    @POST("work/ApproveSh")
    Observable<BaseModel<Object>> approveSh(@Field("leave_id") String leave_id, @Field("status") String status);

    /**
     * 审批外出接口
     */
    @FormUrlEncoded
    @POST("work/goOut/examine")
    Observable<BaseModel<Object>> goOutExamine(@Field("leave_id") String leave_id, @Field("status") String status);


    /**
     * 审批外出接口
     */
    @FormUrlEncoded
    @POST("work/make/card/examine")
    Observable<BaseModel<Object>> markCardExamine(@Field("leave_id") String leave_id, @Field("status") String status);

    /**
     * 审批外勤接口
     */
    @FormUrlEncoded
    @POST("work/wq/examine")
    Observable<BaseModel<Object>> wqExamine(@Field("leave_id") String leave_id, @Field("status") String status);

    /**
     * 审批外勤接口
     */
    @FormUrlEncoded
    @POST("work/overtime/examine")
    Observable<BaseModel<Object>> overTimeExamine(@Field("leave_id") String leave_id, @Field("status") String status);

    /**
     * 消息以读
     */
    @FormUrlEncoded
    @POST("message/getMessageRead")
    Observable<BaseModel<Object>> getMessageRead(@Field("type") String type, @Field("msg_id") String msgId);


    /**
     * 获取工资条
     */
    @FormUrlEncoded
    @POST("user/getSalary")
    Observable<BaseModel<SalaryBean>> getSalary(@Field("month") String month);

    /**
     * 提交审批表单
     */
    @FormUrlEncoded
    @POST("work/createApprove")
    Observable<BaseModel<Object>> submitForm(@Field("model_id") String model_id, @Field("leader_ids") String leader_ids, @FieldMap() HashMap<String, String> forms);

    @FormUrlEncoded
    @POST("work/vacation/log/list")
    Observable<BaseModel<VacationLogBean>> vacationLogList(@FieldMap() HashMap<String, String> map);

    /**
     * 外勤申请
     */
    @FormUrlEncoded
    @POST("work/wq/add")
    Observable<BaseModel<Object>> wqAdd(@Field("model_id") String model_id, @Field("leader_ids") String leader_ids, @FieldMap() HashMap<String, String> forms);

    /**
     * 加班申请
     */
    @FormUrlEncoded
    @POST("work/overtime/add")
    Observable<BaseModel<Object>> overTimeAdd(@Field("model_id") String model_id, @Field("leader_ids") String leader_ids, @FieldMap() HashMap<String, String> forms);


    /**
     * 补卡申请
     */
    @FormUrlEncoded
    @POST("work/make/card/add")
    Observable<BaseModel<Object>> cardAdd(@FieldMap() HashMap<String, String> forms);

    /**
     * 外出申请
     */
    @FormUrlEncoded
    @POST("work/goOut/add")
    Observable<BaseModel<Object>> goOutAdd(@FieldMap() HashMap<String, String> forms);

    /**
     * 上传文件
     */
    @Multipart
    @POST()
    Observable<BaseModel<UploadFileBean>> uploadFile(@Url String url, @Part("dir") RequestBody dir, @Part MultipartBody.Part file);


    /**
     * 获取投票列表
     */
    @POST("user/vote/getList")
    Observable<BaseModel<ArrayList<VoteItem>>> getVoteList();

    /**
     * 获取投票详情
     */
    @FormUrlEncoded
    @POST("user/vote/getInfo")
    Observable<BaseModel<VoteBean>> getVoteInfo(@Field("id") String id);

    /**
     * 获取投票详情
     */
    @FormUrlEncoded
    @POST("user/vote/doVote")
    Observable<BaseModel<Boolean>> doVote(@Field("id") String id, @Field("status") String status);


    /**
     * 获取培训列表
     */
    @FormUrlEncoded
    @POST("user/train/getList")
    Observable<BaseModel<ArrayList<TrainItem>>> getTrainList(@Field("page") String page);

    /**
     * 提交签到操作
     */
    @FormUrlEncoded
    @POST("user/train/doSign")
    Observable<BaseModel<Boolean>> doTrainSign(@Field("sn") String sn, @Field("code") String code);

    /**
     * 获取考核信息
     */
    @FormUrlEncoded
    @POST("user/train/getInfo")
    Observable<BaseModel<TrainBean>> getTrainInfo(@Field("code") String code);

    /**
     * 获取考核结果
     */
    @FormUrlEncoded
    @POST("user/train/getResult")
    Observable<BaseModel<TrainResult>> getTrainResult(@Field("code") String code);

    /**
     * 提交考核操作
     */
    @FormUrlEncoded
    @POST("user/train/doTrain")
    Observable<BaseModel<Boolean>> doTrain(@Field("code") String code, @Field("option_ids") String option_ids);


}
